package com.example.databinding.viewModel;

import android.util.Log;

import androidx.databinding.ObservableField;

import com.example.databinding.bean.User;

public class UserViewModel2 {
    private ObservableField<User> userObservableField;

    public UserViewModel2() {
        User user = new User("Jack");
        userObservableField = new ObservableField<>();
        userObservableField.set(user);
    }

    public String getUserName() {
        return userObservableField.get().userName;
    }

    public void setUserName(String userName) {
        Log.d("guaimiao", "set userName " + userName);
        userObservableField.get().userName = userName;
    }


}
